#!/bin/sh

if [ ! -f %OPTWARE_TARGET_PREFIX%/lib/locale/locale-archive ] || [ ! -f %OPTWARE_TARGET_PREFIX%/lib/locale/.locale_generated ]; then

	rm -f %OPTWARE_TARGET_PREFIX%/lib/locale/.locale_generated %OPTWARE_TARGET_PREFIX%/lib/locale/locale-archive

	echo -n "Generating locale-archive with default locales ... "

	mkdir -p %OPTWARE_TARGET_PREFIX%/lib/locale

	%OPTWARE_TARGET_PREFIX%/bin/localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i de_DE -f ISO-8859-1 de_DE
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i de_DE -f UTF-8 de_DE.UTF-8
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i en_GB -f UTF-8 en_GB.UTF-8
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i en_HK -f ISO-8859-1 en_HK
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i en_PH -f ISO-8859-1 en_PH
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i en_US -f ISO-8859-1 en_US
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i en_US -f UTF-8 en_US.UTF-8
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i es_MX -f ISO-8859-1 es_MX
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i fa_IR -f UTF-8 fa_IR
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i fr_FR -f ISO-8859-1 fr_FR
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i it_IT -f ISO-8859-1 it_IT
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i it_IT -f UTF-8 it_IT.UTF-8
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i ja_JP -f EUC-JP ja_JP
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i ru_RU -f KOI8-R ru_RU.KOI8-R
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i ru_RU -f UTF-8 ru_RU.UTF-8
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i tr_TR -f UTF-8 tr_TR.UTF-8
	%OPTWARE_TARGET_PREFIX%/bin/localedef -i zh_CN -f GB18030 zh_CN.GB18030

	touch %OPTWARE_TARGET_PREFIX%/lib/locale/.locale_generated

	echo "Done"

fi
